home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_1 / doordr50.zip / UNITINTR.ARJ / ASYNC.INT < prev    next >
Text File  |  1992-02-02  |  5KB  |  107 lines

  1. {*--------------------------------------------------------------------------*}
  2. {*                                                                          *}
  3. {*  Status byte definition (C_Status):                                      *}
  4. {*                                                                          *}
  5. {*  7   6   5   4   3   2   1   0                                           *}
  6. {*  |   |   |   |   |   |   |   |____ Input buffer empty                    *}
  7. {*  |   |   |   |   |   |   |________ Input buffer full                     *}
  8. {*  |   |   |   |   |   |____________ Output buffer empty                   *}
  9. {*  |   |   |   |   |________________ Output buffer full                    *}
  10. {*  |   |   |   |____________________ Input buffer overflow                 *}
  11. {*  |   |   |________________________ Output buffer overflow                *}
  12. {*  |   |____________________________ Hard handshake active (xmit stopped)  *}
  13. {*  |________________________________ Soft handshake active (xmit stopped)  *}
  14. {*                                                                          *}
  15. {*  Control byte definition (C_Ctrl):                                       *}
  16. {*                                                                          *}
  17. {*  7   6   5   4   3   2   1   0                                           *}
  18. {*  |   |   |   |   |   |   |   |____ Enable RTS handshake                  *}
  19. {*  |   |   |   |   |   |   |________ Enable CTS handshake                  *}
  20. {*  |   |   |   |   |   |____________ Enable software handshake             *}
  21. {*  |   |   |   |   |________________                                       *}
  22. {*  |   |   |   |____________________                                       *}
  23. {*  |   |   |________________________                                       *}
  24. {*  |   |____________________________                                       *}
  25. {*  |________________________________                                       *}
  26. {*                                                                          *}
  27. {****************************************************************************}
  28.  
  29. {$R-,V-,B-,S-}
  30.  
  31. Unit ASYNC;
  32.  
  33. INTERFACE
  34.  
  35. {----------------------------------------------------------------------------}
  36.  
  37. Const
  38.   C_MinBaud = 50;
  39.   C_MaxBaud = 115200;
  40.  
  41.   { Base port addresses & interrupt usage }
  42.  
  43.   C_MaxPort = 4;
  44.   C_MaxCom : Byte = C_MaxPort;
  45.   C_PortAddr : Array[1..C_MaxPort] Of Word = ($03F8,$02F8,$03E8,$02E8);
  46.   C_PortInt : Array[1..C_MaxPort] Of Byte = (4,3,4,3);
  47.  
  48. {----------------------------------------------------------------------------}
  49.  
  50. Type
  51.   C_PointerArray = Array[1..C_MaxPort] Of Pointer;
  52.   C_WordArray = Array[1..C_MaxPort] Of Word;
  53.   C_ByteArray = Array[1..C_MaxPort] Of Byte;
  54.   C_CharArray = Array[1..C_MaxPort] Of Char;
  55.   C_BooleanArray = Array[1..C_MaxPort] Of Boolean;
  56.  
  57. {----------------------------------------------------------------------------}
  58.  
  59. Var
  60.   C_InBufPtr,C_OutBufPtr : C_PointerArray;    { Input/output buffer pointers }
  61.   C_InHead,C_OutHead     : C_WordArray;       { Input/output head pointers }
  62.   C_InTail,C_OutTail     : C_WordArray;       { Input/output tail pointers }
  63.   C_InSize,C_OutSize     : C_WordArray;       { Input/output buffer sizes }
  64.   C_RTSOn,C_RTSOff       : C_WordArray;       { RTS assert/drop buffer points }
  65.   C_StartChar,C_StopChar : C_CharArray;       { Soft hndshake start/stop char }
  66.   C_Status,C_Ctrl        : C_ByteArray;       { STATUS and CONTROL registers }
  67.   C_XL3Ptr               : C_ByteArray;
  68.   C_PortOpen             : C_BooleanArray;    { Port open/close flags }
  69.   C_Temp : Word;                              { Used for debugging }
  70.   C_msrport: word;
  71.   oldier,oldmcr: byte;
  72.   c_buffull: c_wordarray;
  73.  
  74. {----------------------------------------------------------------------------}
  75.  
  76. Function  ComReadCh(ComPort:Byte) : Char;
  77. Function  ComReadChW(ComPort:Byte) : Char;
  78. Procedure ComWriteCh(ComPort:Byte; Ch:Char);
  79. Procedure ComWriteChW(ComPort:Byte; Ch:Char);
  80. Procedure SetDTR(ComPort:Byte; Assert:Boolean);
  81. Procedure SetRTS(ComPort:Byte; Assert:Boolean);
  82. Procedure SetOUT1(ComPort:Byte; Assert:Boolean);
  83. Procedure SetOUT2(ComPort:Byte; Assert:Boolean);
  84. Function  CTSStat(ComPort:Byte) : Boolean;
  85. Function  DSRStat(ComPort:Byte) : Boolean;
  86. Function  RIStat(ComPort:Byte) : Boolean;
  87. Function  DCDStat(ComPort:Byte) : Boolean;
  88. Procedure SetRTSMode(ComPort:Byte; Mode:Boolean; RTSOn,RTSOff:Word);
  89. Procedure SetCTSMode(ComPort:Byte; Mode:Boolean);
  90. Procedure SoftHandshake(ComPort:Byte; Mode:Boolean; Start,Stop:Char);
  91. Procedure ClearCom(ComPort:Byte; IO:Char);
  92. Function  ComBufferLeft(ComPort:Byte; IO:Char) : Word;
  93. Procedure ComWaitForClear(ComPort:Byte);
  94. Procedure ComWrite(ComPort:Byte; St:String);
  95. Procedure ComWriteln(ComPort:Byte; St:String);
  96. Procedure ComWriteWithDelay(ComPort:Byte; St:String; Dly:Word);
  97. Procedure ComReadln(ComPort:Byte; Var St:String; Size:Byte; Echo:Boolean);
  98. Function  ComExist(ComPort:Byte) : Boolean;
  99. Function  ComTrueBaud(Baud:Longint) : Real;
  100. Procedure ComParams(ComPort:Byte; Baud:LongInt; WordSize:Byte; Parity:Char; StopBits:Byte);
  101. Function  OpenCom(ComPort:Byte; InBufferSize,OutBufferSize:Word) : Boolean;
  102. Procedure CloseCom(ComPort:Byte);
  103. Procedure CloseAllComs;
  104.  
  105. {----------------------------------------------------------------------------}
  106.  
  107.